/*
 * ECU_CAN.h
 *
 *  Created on: 2015-1-16
 *      Author: Hongjie Ma
 */

#ifndef ECU_CAN_H_
#define ECU_CAN_H_

typedef enum
{
	_250kbps,
	_500kbps,
	_1000kbps,
} CAN_Baudrate;

typedef enum
{
	Yes,
	No,
} CAN_TR;

typedef enum
{
	Tx,
	Rx,
}CAN_RxORTx ;

typedef enum
{
	StandardID,
	ExtendID,
}CAN_IDtype ;
typedef enum
{
	MoEnable,
	MoDisable,
}EnORDisable;
typedef enum
{
	Byte_1,
	Byte_2,
	Byte_3,
	Byte_4,
	Byte_5,
	Byte_6,
	Byte_7,
	Byte_8,
}CANMoDLC;

typedef struct
{
	CAN_Baudrate BR0;
	CAN_Baudrate BR1;
	CAN_TR	TR0;
	CAN_TR	TR1;
} CAN_Nodestr;


typedef struct CAN_BaudRateType
{
  /** Baud rate Prescaler value */
  uint8_t BaudRatePresc;
  /** Synchronization Jump Width */
  uint8_t SyncJumpWidth;
  /** Time segment 1  */
  uint8_t TimeSEG1;
  /** Time segment 2b */
  uint8_t TimeSEG2;
  /** Divide prescaler by 8 */
  uint8_t DIV8;
}CAN_BaudRateType;



//typedef struct CAN_HandleType
//{
//  /** Node baud rate */
//  CAN_BaudRateType BaudRate;
//  /** Node offset value */
//  CAN_NODE_TypeDef* CanNodeRegs;
//  /** Pointer to dynamic data elements */
//  CAN001_DynamicDataType* DynamicData;
//  /** Current node No */
//  uint8_t NodeID;
//  /** Loop back mode selection */
//  uint8_t LoopBackModeEn;
//  /** Total message object allocated to node list */
//  uint8_t	NodeMONo;
//  /** First message object no allocated the node list */
//  uint8_t FirstMOMapping;
//}CAN_HandleType;





extern void TIU_CAN_Init(void);
extern void ConfigGeneralMessageObject(void);

#endif /* ECU_CAN_H_ */
